package edu.hit.crawler.io;

import java.util.HashMap;

public class Response {

	private String url;
	private int code;
	private byte[] content;
	private HashMap<String, String> MetaInfo;
	
	
	public Response(String url, int code) {
		this.url = url;
		this.code = code;
	}
	
	public Response(String url, int code,byte[] content) {
		this.url = url;
		this.code = code;
		this.content = content;
	}
	public Response(String url, int code, byte[] content, HashMap<String, String> meta) {
		this.url = url;
		this.code = code;
		this.content = content;
		this.MetaInfo = meta;
	}
	
	
	public String getUrl() {
		return url;
	}
	
	public void setUrl(String url) {
		this.url = url;
	}
	
	
	public byte[] getContent() {
		return content;
	}
	
	public void setContent(byte[] content) {
		this.content = content;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}
	
	public String getHeader(String key) {
		if (null == MetaInfo) {
			return null;
		}
		if (MetaInfo.containsKey(key)) {
			return MetaInfo.get(key);
		}
		return null;
	}

}
